home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / misc / pclta-1.000 / pclta-1 / hostappl / ni_msg.h < prev   
Encoding:
C/C++ Source or Header  |  1996-03-18  |  25.2 KB  |  664 lines

  1. /*
  2.  * ni_msg.h,v 1.0 1996/03/18 14:18:34 miksic Exp
  3.  */
  4.  
  5. /* NI_MSG.H -- LONWORKS network interface protocol message definitions.
  6.  * Copyright (c) 1993 by Echelon Corporation.
  7.  * All Rights Reserved.
  8.  */
  9.  
  10. /*
  11.  ****************************************************************************
  12.  * Application buffer structures for sending and receiving messages to and
  13.  * from a network interface.  The 'ExpAppBuffer' and 'ImpAppBuffer'
  14.  * structures define the application buffer structures with and without
  15.  * explicit addressing.  These structures have up to four parts:
  16.  *
  17.  *   Network Interface Command (NI_Hdr)                        (2 bytes)
  18.  *   Message Header (MsgHdr)                                   (3 bytes)
  19.  *   Network Address (ExplicitAddr)                            (11 bytes)
  20.  *   Data (MsgData)                                            (varies)
  21.  *
  22.  * Network Interface Command (NI_Hdr):
  23.  *
  24.  *   The network interface command is always present.  It contains the
  25.  *   network interface command and queue specifier.  This is the only
  26.  *   field required for local network interface commands such as niRESET.
  27.  *
  28.  * Message Header (MsgHdr: union of NetVarHdr and ExpMsgHdr):
  29.  *
  30.  *   This field is present if the buffer is a data transfer or a completion
  31.  *   event.  The message header describes the type of LONTALK message
  32.  *   contained in the data field.
  33.  *
  34.  *   NetVarHdr is used if the message is a network variable message and
  35.  *   network interface selection is enabled.
  36.  *
  37.  *   ExpMsgHdr is used if the message is an explicit message, or a network
  38.  *   variable message and host selection is enabled (this is the default
  39.  *   for the SLTA).
  40.  *
  41.  * Network Address (ExplicitAddr:  SendAddrDtl, RcvAddrDtl, or RespAddrDtl)
  42.  *
  43.  *   This field is present if the message is a data transfer or completion
  44.  *   event, and explicit addressing is enabled.  The network address
  45.  *   specifies the destination address for downlink application buffers,
  46.  *   or the source address for uplink application buffers.  Explicit
  47.  *   addressing is the default for the SLTA.
  48.  *
  49.  *   SendAddrDtl is used for outgoing messages or NV updates.
  50.  *
  51.  *   RcvAddrDtl is used  for incoming messages or unsolicited NV updates.
  52.  *
  53.  *   RespAddrDtl is used for incoming responses or NV updates solicited
  54.  *   by a poll.
  55.  *
  56.  * Data (MsgData: union of UnprocessedNV, ProcessedNV, and ExplicitMsg)
  57.  *
  58.  *   This field is present if the message is a data transfer or completion
  59.  *   event.
  60.  *
  61.  *   If the message is a completion event, then the first two bytes of the
  62.  *   data are included.  This provides the NV index, the NV selector, or the
  63.  *   message code as appropriate.
  64.  *
  65.  *   UnprocessedNV is used if the message is a network variable update, and
  66.  *   host selection is enabled. It consists of a two-byte header followed by
  67.  *   the NV data.
  68.  *
  69.  *   ProcessedNV is used if the message is a network variable update, and
  70.  *   network interface selection is enabled. It consists of a two-byte header
  71.  *   followed by the NV data.
  72.  *
  73.  *   ExplicitMsg is used if the message is an explicit message.  It consists
  74.  *   of a one-byte code field followed by the message data.
  75.  *
  76.  * Note - the fields defined here are for a little-endian (Intel-style)
  77.  * host processor, such as the 80x86 processors used in PC compatibles.
  78.  * Bit fields are allocated right-to-left within a byte.
  79.  * For a big-endian (Motorola-style) host, bit fields are typically
  80.  * allocated left-to-right.  For this type of processor, reverse
  81.  * the bit fields within each byte.  Compare the NEURON C include files
  82.  * ADDRDEFS.H and MSG_ADDR.H, which are defined for the big-endian NEURON
  83.  * CHIP.
  84.  ****************************************************************************
  85.  */
  86.  
  87. /* Change the following declarations to port to a non-80x86  */
  88.  
  89. typedef unsigned char byte;     /* 8 bits */
  90. typedef unsigned char bits;          /* bit fields */
  91. typedef unsigned short word;      /* 16 bits */
  92.  
  93. typedef enum { FALSE = 0, TRUE } boolean;
  94.  
  95. /*
  96.  ****************************************************************************
  97.  * Network Interface Command data structure.  This is the application-layer
  98.  * header used for all messages to and from a LONWORKS network interface.
  99.  ****************************************************************************
  100.  */
  101.  
  102. /* Literals for the 'cmd.q.queue' nibble of NI_Hdr. */
  103.  
  104. typedef enum {
  105.     niTQ          =  2,             /* Transaction queue                    */
  106.     niTQ_P        =  3,             /* Priority transaction queue           */
  107.     niNTQ         =  4,             /* Non-transaction queue                */
  108.     niNTQ_P       =  5,             /* Priority non-transaction queue       */
  109.     niRESPONSE    =  6,             /* Response msg & completion event queue*/
  110.     niINCOMING    =  8              /* Received message queue               */
  111. } NI_Queue;
  112.  
  113. /* Literals for the 'cmd.q.q_cmd' nibble of NI_Hdr. */
  114.  
  115. typedef enum {
  116.     niCOMM           = 1,           /* Data transfer to/from network        */
  117.     niNETMGMT        = 2            /* Local network management/diagnostics */
  118. } NI_QueueCmd;
  119.  
  120. /* Literals for the 'cmd.noq' byte of NI_Hdr. */
  121.  
  122. typedef enum {
  123.     niNULL           = 0x00,
  124.     niTIMEOUT        = 0x30,        /* Not used                             */
  125.     niCRC            = 0x40,        /* Not used                             */
  126.     niRESET          = 0x50,
  127.     niFLUSH_COMPLETE = 0x60,        /* Uplink                               */
  128.     niFLUSH_CANCEL   = 0x60,        /* Downlink                             */
  129.     niONLINE         = 0x70,
  130.     niOFFLINE        = 0x80,
  131.     niFLUSH          = 0x90,
  132.     niFLUSH_IGN      = 0xA0,
  133.     niSLEEP          = 0xB0,        /* SLTA only                            */
  134.     niACK            = 0xC0,
  135.     niNACK           = 0xC1,        /* SLTA only                            */
  136.     niSSTATUS        = 0xE0,        /* SLTA only                            */
  137.     niPUPXOFF        = 0xE1,
  138.     niPUPXON         = 0xE2,
  139.     niPTRHROTL       = 0xE4,        /* Not used                             */
  140.     niDRV_CMD        = 0xF0,        /* Not used                             */
  141. } NI_NoQueueCmd;
  142.  
  143. /*
  144.  * Header for network interface messages.  The header is a union of
  145.  * two command formats: the 'q' format is used for the niCOMM and
  146.  * niNETMGMT commands that require a queue specification; the 'noq'
  147.  * format is used for all other network interface commands.
  148.  * Both formats have a length specification where:
  149.  *
  150.  *      length = header (3) + address field (11 if present) + data field
  151.  *
  152.  * WARNING:  The fields shown in this structure do NOT reflect the actual
  153.  * structure required by the network interface.  Depending on the network
  154.  * interface, the network driver may change the order of the data and add
  155.  * additional fields to change the application-layer header to a link-layer
  156.  * header.  See the description of the link-layer header in Chapter 2 of the
  157.  * Host Application Programmer's Guide.
  158.  */
  159.  
  160. typedef union {
  161.     struct {
  162.         bits queue  :4;         /* Network interface message queue      */
  163.                                 /* Use value of type 'NI_Queue'         */
  164.         bits q_cmd  :4;         /* Network interface command with queue */
  165.                                 /* Use value of type 'NI_QueueCmd'      */
  166.         bits length :8;         /* Length of the buffer to follow       */
  167.     } q;                        /* Queue option                         */
  168.     struct {
  169.         byte     cmd;           /* Network interface command w/o queue  */
  170.                                 /* Use value of type 'NI_NoQueueCmd'    */
  171.         byte     length;        /* Length of the buffer to follow       */
  172.     } noq;                      /* No queue option                      */
  173. } NI_Hdr;
  174.  
  175. /*
  176.  ****************************************************************************
  177.  * Message Header structure for sending and receiving explicit
  178.  * messages and network variables which are not processed by the
  179.  * network interface (host selection enabled).
  180.  ****************************************************************************
  181.  */
  182.  
  183. /* Literals for 'st' fields of ExpMsgHdr and NetVarHdr. */
  184.  
  185. typedef enum {
  186.    ACKD            = 0,
  187.    UNACKD_RPT      = 1,
  188.    UNACKD          = 2,
  189.    REQUEST         = 3
  190. } ServiceType;
  191.  
  192. /* Literals for 'cmpl_code' fields of ExpMsgHdr and NetVarHdr. */
  193.  
  194. typedef enum {
  195.     MSG_NOT_COMPL  = 0,             /* Not a completion event               */
  196.     MSG_SUCCEEDS   = 1,             /* Successful completion event          */
  197.     MSG_FAILS      = 2              /* Failed completion event              */
  198. } ComplType;
  199.  
  200. /* Explicit message and Unprocessed NV Application Buffer. */
  201.  
  202. typedef struct {
  203.  
  204.     bits   tag       :4;        /* Message tag for implicit addressing  */
  205.                                 /* Magic cookie for explicit addressing */
  206.     bits   auth      :1;        /* 1 => Authenticated                   */
  207.     bits   st        :2;        /* Service Type - see 'ServiceType'     */
  208.     bits   msg_type  :1;        /* 0 => explicit message                */
  209.                                 /*      or unprocessed NV               */
  210. /*--------------------------------------------------------------------------*/
  211.     bits   response  :1;        /* 1 => Response, 0 => Other            */
  212.     bits   pool      :1;        /* 0 => Outgoing                        */
  213.     bits   alt_path  :1;        /* 1 => Use path specified in 'path'    */
  214.                                 /* 0 => Use default path                */
  215.     bits   addr_mode :1;        /* 1 => Explicit addressing,            */
  216.                                 /* 0 => Implicit                        */
  217.                                 /* Outgoing buffers only                */
  218.     bits   cmpl_code :2;        /* Completion Code - see 'ComplType'    */
  219.     bits   path      :1;        /* 1 => Use alternate path,             */
  220.                                 /* 0 => Use primary path                */
  221.                                 /*      (if 'alt_path' is set)          */
  222.     bits   priority  :1;        /* 1 => Priority message                */
  223. /*--------------------------------------------------------------------------*/
  224.     byte   length;              /* Length of msg or NV to follow        */
  225.                                 /* not including any explicit address   */
  226.                                 /* field, includes code byte or         */
  227.                                 /* selector bytes                       */
  228. } ExpMsgHdr;
  229.  
  230. /*
  231.  ****************************************************************************
  232.  * Message Header structure for sending and receiving network variables
  233.  * that are processed by the network interface (network interface
  234.  * selection enabled).
  235.  ****************************************************************************
  236.  */
  237.  
  238. typedef struct {
  239.     bits   tag       :4;        /* Magic cookie for correlating         */
  240.                                 /* responses and completion events      */
  241.     bits   rsvd0     :2;
  242.     bits   poll      :1;        /* 1 => Poll, 0 => Other                */
  243.     bits   msg_type  :1;        /* 1 => Processed network variable      */
  244. /*--------------------------------------------------------------------------*/
  245.     bits   response  :1;        /* 1 => Poll response, 0 => Other       */
  246.     bits   pool      :1;        /* 0 => Outgoing                        */
  247.     bits   trnarnd   :1;        /* 1 => Turnaround Poll, 0 => Other     */
  248.     bits   addr_mode :1;        /* 1 => Explicit addressing,            */
  249.                                 /* 0 => Implicit addressing             */
  250.     bits   cmpl_code :2;        /* Completion Code - see above          */
  251.     bits   path      :1;        /* 1 => Used alternate path             */
  252.                                 /* 0 => Used primary path               */
  253.                                 /*      (incoming only)                 */
  254.     bits   priority  :1;        /* 1 => Priority msg (incoming only)    */
  255. /*--------------------------------------------------------------------------*/
  256.     byte   length;              /* Length of network variable to follow */
  257.                                 /* not including any explicit address   */
  258.                                 /* not including index and rsvd0 byte   */
  259. } NetVarHdr;
  260.  
  261. /* Union of all message headers. */
  262.  
  263. typedef union {
  264.     ExpMsgHdr  exp;
  265.     NetVarHdr  pnv;
  266. } MsgHdr;
  267.  
  268. /*
  269.  ****************************************************************************
  270.  * Network Address structures for sending messages with explicit addressing
  271.  * enabled.
  272.  ****************************************************************************
  273.  */
  274.  
  275. /* Literals for 'type' field of destination addresses for outgoing messages. */
  276.  
  277. typedef enum {
  278.     UNASSIGNED     = 0,
  279.     SUBNET_NODE    = 1,
  280.     NEURON_ID      = 2,
  281.     BROADCAST      = 3,
  282.     IMPLICIT       = 126,    /* not a real destination type */
  283.     LOCAL          = 127,    /* not a real destination type */
  284. } AddrType;
  285.  
  286. /* Group address structure.  Use for multicast destination addresses. */
  287.  
  288. typedef struct {
  289.     bits   size      :7;        /* Group size (0 => huge group)         */
  290.     bits   type      :1;        /* 1 => Group                           */
  291.  
  292.     bits   rsvd0     :7;
  293.     bits   domain    :1;        /* Domain index                         */
  294.  
  295.     bits   retry     :4;        /* Retry count                          */
  296.     bits   rpt_timer :4;        /* Retry repeat timer                   */
  297.  
  298.     bits   tx_timer  :4;        /* Transmit timer index                 */
  299.     bits   rsvd1     :4;
  300.  
  301.     byte       group;           /* Group ID                             */
  302. } SendGroup;
  303.  
  304. /* Subnet/node ID address.  Use for a unicast destination address. */
  305.  
  306. typedef struct {
  307.     byte   type;                /* SUBNET_NODE                          */
  308.  
  309.     bits   node      :7;        /* Node number                          */
  310.     bits   domain    :1;        /* Domain index                         */
  311.  
  312.     bits   retry     :4;        /* Retry count                          */
  313.     bits   rpt_timer :4;        /* Retry repeat timer                   */
  314.  
  315.     bits   tx_timer  :4;        /* Transmit timer index                 */
  316.     bits   rsvd1     :4;
  317.  
  318.     bits   subnet    :8;        /* Subnet ID                            */
  319. } SendSnode;
  320.  
  321. /* 48-bit NEURON ID destination address. */
  322.  
  323. #define NEURON_ID_LEN 6
  324.  
  325. typedef struct {
  326.     byte   type;                /* NEURON_ID                            */
  327.  
  328.     bits   rsvd0      :7;
  329.     bits   domain     :1;       /* Domain index                         */
  330.  
  331.     bits   retry      :4;       /* Retry count                          */
  332.     bits   rpt_timer  :4;       /* Retry repeat timer                   */
  333.  
  334.     bits   tx_timer   :4;       /* Transmit timer index                 */
  335.     bits   rsvd2      :4;
  336.  
  337.     bits   subnet     :8;       /* Subnet ID, 0 => pass all routers     */
  338.     byte   nid[ NEURON_ID_LEN ];  /* NEURON ID                          */
  339. } SendNrnid;
  340.  
  341. /* Broadcast destination address. */
  342.  
  343. typedef struct {
  344.     byte   type;                /* BROADCAST                            */
  345.  
  346.     bits   backlog     :6;      /* Backlog                              */
  347.     bits   rsvd0       :1;
  348.     bits   domain      :1;      /* Domain index                         */
  349.  
  350.     bits   retry       :4;      /* Retry count                          */
  351.     bits   rpt_timer   :4;      /* Retry repeat timer                   */
  352.  
  353.     bits   tx_timer    :4;      /* Transmit timer index                 */
  354.     bits   rsvd2       :4;
  355.  
  356.     bits   subnet      :8;      /* Subnet ID, 0 => domain-wide          */
  357. } SendBcast;
  358.  
  359. /* Address formats for special host addresses.                          */
  360.  
  361. typedef struct {
  362.     byte   type;                /*  LOCAL                               */
  363. } SendLocal;
  364.  
  365. typedef struct {
  366.    byte    type;                /* IMPLICIT */
  367.    byte    msg_tag;             /* address table entry number */
  368. } SendImplicit;
  369.  
  370. /* Union of all destination addresses. */
  371.  
  372. typedef union {
  373.     SendGroup      gp;
  374.     SendSnode      sn;
  375.     SendBcast      bc;
  376.     SendNrnid      id;
  377.     SendLocal      lc;
  378.     SendImplicit   im;
  379. } SendAddrDtl;
  380.  
  381. /*
  382.  ****************************************************************************
  383.  * Network Address structures for receiving messages with explicit
  384.  * addressing enabled.
  385.  ****************************************************************************
  386.  */
  387.  
  388. /* Received subnet/node ID destination address.  Used for unicast messages. */
  389.  
  390. typedef struct {
  391.     bits       subnet :8;
  392.     bits       node   :7;
  393.     bits              :1;
  394. } RcvSnode;
  395.  
  396. /* Received 48-bit NEURON ID destination address. */
  397.  
  398. typedef struct {
  399.     byte   subnet;
  400.     byte   nid[ NEURON_ID_LEN ];
  401. } RcvNrnid;
  402.  
  403. /* Union of all received destination addresses. */
  404.  
  405. typedef union {
  406.     byte       gp;                  /* Group ID for multicast destination   */
  407.     RcvSnode   sn;                  /* Subnet/node ID for unicast           */
  408.     RcvNrnid   id;                  /* 48-bit NEURON ID destination address */
  409.     byte       subnet;              /* Subnet ID for broadcast destination  */
  410.                                     /* 0 => domain-wide */
  411. } RcvDestAddr;
  412.  
  413. /* Source address of received message.  Identifies */
  414. /* network address of node sending the message.    */
  415.  
  416. typedef struct {
  417.     bits   subnet  :8;
  418.     bits   node    :7;
  419.     bits           :1;
  420. } RcvSrcAddr;
  421.  
  422. /* Literals for the 'format' field of RcvAddrDtl. */
  423.  
  424. typedef enum {
  425.     ADDR_RCV_BCAST  = 0,
  426.     ADDR_RCV_GROUP  = 1,
  427.     ADDR_RCV_SNODE  = 2,
  428.     ADDR_RCV_NRNID  = 3
  429. } RcvDstAddrFormat;
  430.  
  431. /* Address field of incoming message. */
  432.  
  433. typedef struct {
  434. #ifdef _MSC_VER
  435.     byte    kludge;    /* Microsoft C does not allow odd-length bitfields */
  436. #else
  437.     bits    format      :6;     /* Destination address type             */
  438.                                 /* See 'RcvDstAddrFormat'               */
  439.     bits    flex_domain :1;     /* 1 => broadcast to unconfigured node  */
  440.     bits    domain      :1;     /* Domain table index                   */
  441. #endif
  442.     RcvSrcAddr  source;             /* Source address of incoming message   */
  443.     RcvDestAddr dest;               /* Destination address of incoming msg  */
  444. } RcvAddrDtl;
  445.  
  446. /*
  447.  ****************************************************************************
  448.  * Network Address structures for receiving responses with explicit
  449.  * addressing enabled.
  450.  ****************************************************************************
  451.  */
  452.  
  453. /* Source address of response message. */
  454.  
  455. typedef struct {
  456.     bits   subnet   :8;
  457.     bits   node     :7;
  458.     bits   is_snode :1;        /* 0 => Group response,                 */
  459.                                /* 1 => snode response                  */
  460. } RespSrcAddr;
  461.  
  462. /* Destination of response to unicast request. */
  463.  
  464. typedef struct {
  465.     bits   subnet   :8;
  466.     bits   node     :7;
  467.     bits            :1;
  468. } RespSnode;
  469.  
  470. /* Destination of response to multicast request. */
  471.  
  472. typedef struct {
  473.     bits   subnet   :8;
  474.     bits   node     :7;
  475.     bits            :1;
  476.     bits   group    :8;
  477.     bits   member   :6;
  478.     bits            :2;
  479. } RespGroup;
  480.  
  481. /* Union of all response destination addresses. */
  482.  
  483. typedef union {
  484.     RespSnode  sn;
  485.     RespGroup  gp;
  486. } RespDestAddr;
  487.  
  488. /* Address field of incoming response. */
  489.  
  490. typedef struct {
  491. #ifdef _MSC_VER
  492.     byte     kludge;     /* Microsoft C does not allow odd-length bitfields */
  493. #else
  494.     bits                 :6;
  495.     bits     flex_domain :1;    /* 1=> Broadcast to unconfigured node   */
  496.     bits     domain      :1;    /* Domain table index                   */
  497. #endif
  498.     RespSrcAddr  source;            /* Source address of incoming response  */
  499.     RespDestAddr dest;              /* Destination address of incoming resp */
  500. } RespAddrDtl;
  501.  
  502. /* Explicit address field if explicit addressing is enabled. */
  503.  
  504. typedef union {
  505.     RcvAddrDtl  rcv;
  506.     SendAddrDtl snd;
  507.     RespAddrDtl rsp;
  508. } ExplicitAddr;
  509.  
  510. /*
  511.  ****************************************************************************
  512.  * Data field structures for explicit messages and network variables.
  513.  ****************************************************************************
  514.  */
  515.  
  516. /*
  517.  * MAX_NETMSG_DATA specifies the maximum size of the data portion of an
  518.  * application buffer.  MAX_NETVAR_DATA specifies the maximum size of the
  519.  * data portion of a network variable update.  The values specified here
  520.  * are the absolute maximums,based on the LONTALK protocol. Actual limits
  521.  * are based on the buffer sizes defined on the attached NEURON CHIP.
  522.  */
  523.  
  524. #define MAX_NETMSG_DATA 228
  525. #define MAX_NETVAR_DATA 31
  526.  
  527. /* Data field for network variables (host selection enabled). */
  528.  
  529. typedef struct {
  530.     bits   NV_selector_hi :6;
  531.     bits   direction      :1;     /* 1 => output NV, 0 => input NV      */
  532.     bits   must_be_one    :1;     /* Must be set to 1 for NV            */
  533.     bits   NV_selector_lo :8;
  534.     byte       data[ MAX_NETVAR_DATA ]; /* Network variable data            */
  535. } UnprocessedNV;
  536.  
  537. /* Data field for network variables (network interface selection enabled).  */
  538.  
  539. typedef struct {
  540.     byte       index;                 /* Index into NV configuration table  */
  541.     byte       rsvd0;
  542.     byte       data[ MAX_NETVAR_DATA ]; /* Network variable data            */
  543. } ProcessedNV;
  544.  
  545. /* Data field for explicit messages. */
  546.  
  547. typedef struct {
  548.     byte       code;                  /* Message code                       */
  549.     byte       data[ MAX_NETMSG_DATA ]; /* Message data                     */
  550. } ExplicitMsg;
  551.  
  552. /* Union of all data fields. */
  553.  
  554. typedef union {
  555.     UnprocessedNV unv;
  556.     ProcessedNV   pnv;
  557.     ExplicitMsg   exp;
  558. } MsgData;
  559.  
  560. /*
  561.  ****************************************************************************
  562.  * Message buffer types.
  563.  ****************************************************************************
  564.  */
  565.  
  566. /* Application buffer when using explicit addressing. */
  567.  
  568. typedef struct {
  569.     NI_Hdr       ni_hdr;            /* Network interface header             */
  570.     MsgHdr       msg_hdr;           /* Message header                       */
  571.     ExplicitAddr addr;              /* Network address                      */
  572.     MsgData      data;              /* Message data                         */
  573. } ExpAppBuffer;
  574.  
  575. /* Application buffer when not using explicit addressing. */
  576.  
  577. typedef struct {
  578.     NI_Hdr       ni_hdr;            /* Network interface header             */
  579.     MsgHdr       msg_hdr;           /* Message header                       */
  580.     MsgData      data;              /* Message data                         */
  581. } ImpAppBuffer;
  582.  
  583. /*
  584.  ****************************************************************************
  585.  * Network interface error codes.
  586.  ****************************************************************************
  587.  */
  588.  
  589. typedef enum {
  590.     NI_OK = 0,
  591.     NI_NO_DEVICE,
  592.     NI_DRIVER_NOT_OPEN,
  593.     NI_DRIVER_NOT_INIT,
  594.     NI_DRIVER_NOT_RESET,
  595.     NI_DRIVER_ERROR,
  596.     NI_NO_RESPONSES,
  597.     NI_RESET_FAILS,
  598.     NI_TIMEOUT,
  599.     NI_UPLINK_CMD,
  600.     NI_INTERNAL_ERR,
  601. } NI_Code;
  602.  
  603. /***************************** Externals *****************************/
  604.  
  605. NI_Code ni_init( const char * device_name);
  606.                             /* Initialize network interface   */
  607. void ni_close( void );      /* Close network interface */
  608. NI_Code ni_reset( void );   /* Reset network interface        */
  609.  
  610.     /* Assumes only one network interface is open */
  611.  
  612.     /* Assume network interface is configured with explicit addressing ON,
  613.        and network variable processing OFF */
  614.  
  615. NI_Code ni_send_msg_wait(
  616.     ServiceType       service,          /* ACKD, UNACKD_RPT, UNACKD, REQUEST */
  617.     const SendAddrDtl * out_addr,       /* address of outgoing message */
  618.     const MsgData     * out_data,       /* data of outgoing message */
  619.     int               out_length,       /* length of outgoing message */
  620.     boolean           priority,         /* outgoing message priority */
  621.     boolean           out_auth,         /* outgoing message authenticated */
  622.     ComplType       * completion,       /* MSG_SUCCEEDS or MSG_FAILS */
  623.     int             * num_responses,    /* number of received responses */
  624.     RespAddrDtl     * in_addr,          /* address of first response */
  625.     MsgData         * in_data,          /* data of first response */
  626.     int             * in_length         /* length of first response */
  627. );
  628.  
  629. NI_Code ni_get_next_response(         /* get subsequent responses here */
  630.     RespAddrDtl     * in_addr,
  631.     MsgData         * in_data,
  632.     int             * in_length
  633. );
  634.  
  635. NI_Code ni_receive_msg(
  636.     ServiceType     * service,        /* ACKD, UNACKD_RPT, UNACKD, REQUEST */
  637.     RcvAddrDtl      * in_addr,        /* address of incoming msg */
  638.     MsgData         * in_data,        /* data of incoming msg */
  639.     int             * in_length,      /* length of incoming msg */
  640.     boolean         * in_auth         /* if incoming was authenticated */
  641. );
  642.  
  643. NI_Code ni_send_response(         /* send response to last received request */
  644.     MsgData       * out_data,     /* data for outgoing response */
  645.     int             out_length    /* length of outgoing response */
  646. );
  647.  
  648. NI_Code ni_send_immediate( NI_NoQueueCmd command );
  649.             // send an immediate (no queue) command to network interface */
  650.  
  651. extern ExpAppBuffer  msg_out;          /* Outgoing message buffer       */
  652. extern ExpAppBuffer  msg_in;           /* Incoming message buffer       */
  653.  
  654. extern void ni_msg_hdr_init( int msg_size, ServiceType service,
  655.     boolean priority, boolean local, boolean auth, boolean implicit,
  656.     byte msg_tag );
  657.  
  658. void ni_error_display(const char * s, NI_Code ni_error);
  659.                                      /* Display a network interface error*/
  660.  
  661. void ni_msg_display( ExpAppBuffer *msg_ptr );
  662.  
  663.  
  664.